package game.snake.direction;

import game.Field;
import game.Point;
import game.snake.Snake;
import game.snake.SnakeBody;

import java.io.Serializable;

/**
 * The direction of the snake.
 * 
 * @author Sarun Wongtanakarn 5510546166
 * @author Apiwat Jierakulpanit 5510546212
 * @Version 2013.05.01
 */
public abstract class Direction implements Serializable {

	/** The snake that reference. */
	protected Snake snake;

	/**
	 * Constructor with giving snake.
	 * @param snake the snake for reference
	 */
	protected Direction(Snake snake) {
		this.snake = snake;
	}

	/** 
	 * Changes the direction of the snake.
	 * The snake can not return to the opposite direction.
	 * @param direction the new direction for changing
	 */
	public abstract void changeDirection(Direction direction);

	/** 
	 * Grows the snake.
	 * The new SnakeBody has to add after tail. 
	 * @param point the field for adding the new SnakeBody
	 */
	public abstract void growth(Point[][] point);

	/**
	 * Moves a SnakeBody up to it's direction
	 * @param blockbody the SnakeBody for moving
	 * @param field the field of the game
	 */
	public abstract void move(SnakeBody blockBody, Field field);

}
